<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title">工作单位</h4>
</div>
<div class="modal-body">
    <table class="detailTable table table-hover table-striped table-bordered">
        <c:if test="${leaderCheck.operateType==2}">
            <tr>
                <th></th>
                <th>原数据</th>
                <th>新数据</th>
            </tr>
        </c:if>

        <tr>
            <th>
                单位名称：
            </th>
            <td>${data.name}</td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>${newData.name}</td>
            </c:if>
        </tr>
        <tr>
            <th>
                单位代码：
            </th>
            <td>${data.code}</td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>${newData.code}</td>
            </c:if>
        </tr>

        <tr>
            <th>
                单位性质：
            </th>
            <td>
                <c:choose>
                    <c:when test="${data.property==0}">企业</c:when>
                    <c:when test="${data.property==1}">机关</c:when>
                    <c:when test="${data.property==2}">事业单位</c:when>
                    <c:when test="${data.property==3}">社会团体</c:when>
                    <c:when test="${data.property==4}">其他</c:when>
                </c:choose>
            </td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>
                    <c:choose>
                        <c:when test="${newData.property==0}">企业</c:when>
                        <c:when test="${newData.property==1}">机关</c:when>
                        <c:when test="${newData.property==2}">事业单位</c:when>
                        <c:when test="${newData.property==3}">社会团体</c:when>
                        <c:when test="${newData.property==4}">其他</c:when>
                    </c:choose>
                </td>
            </c:if>
        </tr>

        <tr>
            <th>
                联系方式：
            </th>
            <td>${data.phone}</td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>${newData.phone}</td>
            </c:if>
        </tr>
        <tr>
            <th>
                所属机构：
            </th>
            <td>${data.affiliate}</td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>${newData.affiliate}</td>
            </c:if>
        </tr>
        <tr>
            <th>
                所属机构代码：
            </th>
            <td>${data.affiliateCode}</td>
            <c:if test="${leaderCheck.operateType==2}">
                <td>${newData.affiliateCode}</td>
            </c:if>
        </tr>

    </table>
</div>


<script>
    $.each($(".detailTable tr"), function (i, v) {
        var tds=  $(this).find("td");
        if (tds.length==2&&tds[0].innerText.trim()!=tds[1].innerText.trim()){
            $(this).find("td").css("color","red");
        }
    })
</script>